// System.cpp

#include <fstream>
#include <iostream>
#include "System.h"

using namespace std;

void System::printDataTypeSizes() {
    cout << "Type" << "\t\t" << "Size\n";
    cout << "int" << "\t\t" << sizeof(int) << "\n";
    cout << "unsigned int" << "\t" << sizeof(unsigned int)<< "\n";
    cout << "signed int" << "\t" << sizeof(signed int)<< "\n";
    cout << "short int" << "\t" << sizeof(short int)<< "\n";
    cout << "long int" << "\t" << sizeof(long int)<< "\n";
    cout << "char" << "\t\t" << sizeof(char)<< "\n";
    cout << "unsigned char" << "\t" << sizeof(unsigned char)<< "\n";
    cout << "signed char" << "\t" << sizeof(signed char)<< "\n";
    cout << "float" << "\t\t" << sizeof(float)<< "\n";
    cout << "double" << "\t\t" << sizeof(double)<< "\n";
    cout << "long double" << "\t" << sizeof(long double)<< "\n";
    cout << "bool" << "\t\t" << sizeof(bool)<< "\n";
    cout << "pointer" << "\t\t" << sizeof(bool*)<< "\n";
}

bool System::compare(const string & file1, const string & file2, const string & option) {
	//http://en.wikipedia.org/wiki/Ifstream

	ifstream StreamFile1;
	StreamFile1.open(file1.c_str()); 	
	
	ifstream StreamFile2;
	StreamFile2.open(file2.c_str()); 		
	
	string lineFile1;
	string lineFile2;
	
	getline(StreamFile1, lineFile1, '\n');
	getline(StreamFile2, lineFile2, '\n');

	//http://www.cplusplus.com/reference/string/string/c_str.html	
	
	cout << "File 1 Regel :" << lineFile1 << "\n";	
	cout << "File 2 Regel :" << lineFile2 << "\n";	
	
	while(lineFile1 == lineFile2){
		getline(StreamFile1, lineFile1, '\n');
		getline(StreamFile2, lineFile2, '\n');
		
		cout << "File 1 Regel :" << lineFile1 << "\n";	
		cout << "File 2 Regel :" << lineFile2 << "\n";	
		if(StreamFile1.eof() || StreamFile2.eof()){

			if(lineFile1 != lineFile2){
				return 0;
			} else {
				return 1;
			}
		}
	}

	return 0;
}
